SUBDIRS = src/client src/slave src/server
export PKG_CONFIG_PATH := ${PKG_CONFIG_PATH}:$(CURDIR)/lib/pkgconfig

.PHONY: all
all: subdirs

.PHONY: subdirs $(SUBDIRS)
subdirs: $(SUBDIRS)

$(SUBDIRS):
	$(MAKE) -C $@

# Compiles protobuf library and installs it in the bin/, include/, and lib/ dirs
protobufs:
	cd lib/protobuf; ./configure --prefix=$(CURDIR); make; make check; make install
threadpool:
	cd lib/thrpool-0.8; make

.PHONY: clean
clean:
	for d in $(SUBDIRS); do (cd $$d; $(MAKE) clean); done
